{% extends 'backend/bases.html' %}

{% block css %}
{#    <link rel="stylesheet" href="/static/editor.md-master/css/editormd.css">#}
{% endblock %}

{% block article %}
    <h2 class="text-center">添加文章</h2>
    <form action="" method="post">
        {% csrf_token %}
        <p>标题</p>
        <input type="text" name="title" class="form-control">
        <p>内容</p>

            <textarea name="content" id="d1" cols="30" rows="10"></textarea>

        <p>分类</p>
            {% for category in category_list %}
                <input type="radio" name="category" value="{{ category.pk }}">{{ category.name }}
            {% endfor %}

        <p>标签</p>
            {% for tag in tag_list %}
                <input type="checkbox" name="tag" value="{{ tag.pk }}">{{ tag.name }}
            {% endfor %}
    <p><input type="submit" class="btn btn-primary"></p>

    </form>

{% endblock %}

{% block js %}
        <script charset="utf-8" src="/static/kindeditor/kindeditor-all-min.js"></script>
        <script>
                KindEditor.ready(function(K) {
                        window.editor = K.create('#d1',{
                            width: '100%',
                            height:'600px',
                            resizeType:1,
                            uploadJson : '/file_upload/',
                            extraFileUploadParams : {
                                    csrfmiddlewaretoken:'{{ csrf_token }}'
                            }
                        });
                });
        </script>

{% endblock %}